#include "Node.hpp"

// Prints the tree rooted at the first argument in breadth first manner.
void Node::print(Node * node) {
    cout << "Item is: " << node->getItem() << " and count is: " 
        << node->getCount() << endl;
    cout << "It's children are: ";

    hash_map<string, Node *>::const_iterator it = (node->getChildren()).begin(), 
        end = (node->getChildren()).end();

    for ( ; it != end; it++) {
        cout << (it->second)->getItem() << " ";
    }
    
    cout << "\n------------------end of this node --------------------" << endl;

    it = (node->getChildren()).begin(), end = (node->getChildren()).end();

    for ( ; it != end; it++) {
        print(it->second);
    }

    cout << "\n-----------------end of this branch ------------------" << endl;

}
